package com.songlanyun.modules.order.service.impl.createorder;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songlanyun.common.enums.IntegralConstant;
import com.songlanyun.common.enums.OrderConstant;
import com.songlanyun.common.exception.RRException;
import com.songlanyun.common.utils.custom.MathUtils;
import com.songlanyun.modules.account.entity.UserIdentityAssetEntity;
import com.songlanyun.modules.account.service.UserIdentityAssetService;
import com.songlanyun.modules.coupon.entity.CouponReceiveRecordEntity;
import com.songlanyun.modules.coupon.service.CouponReceiveRecordService;
import com.songlanyun.modules.exception.GoodsExceptionEnum;
import com.songlanyun.modules.goods.entity.Goods;
import com.songlanyun.modules.goods.service.GoodsService;
import com.songlanyun.modules.integralrecord.service.IntegralRecordService;
import com.songlanyun.modules.inter.ISaleEntity;
import com.songlanyun.modules.marketing.seckill.entity.SeckillActivity;
import com.songlanyun.modules.marketing.seckill.entity.SeckillActivityGoods;
import com.songlanyun.modules.marketing.seckill.entity.SeckillGoodsSku;
import com.songlanyun.modules.marketing.seckill.service.SeckillActivityGoodsService;
import com.songlanyun.modules.marketing.seckill.service.SeckillActivityService;
import com.songlanyun.modules.marketing.seckill.service.SeckillGoodsSkuService;
import com.songlanyun.modules.memberbill.entity.GiveBalanceDTO;
import com.songlanyun.modules.order.dao.OrderDao;
import com.songlanyun.modules.order.entity.Order;
import com.songlanyun.modules.order.model.dto.SubmitChildOrderDTO;
import com.songlanyun.modules.order.model.dto.SubmitOrderDTO;
import com.songlanyun.modules.order.model.dto.SubmitOrderUseCoupon;
import com.songlanyun.modules.order.model.dto.SubmitShopOrderDTO;
import com.songlanyun.modules.order.model.vo.SubmitChildOrderVo;
import com.songlanyun.modules.order.model.vo.SubmitOrderReceiptVo;
import com.songlanyun.modules.order.model.vo.SubmitOrderVo;
import com.songlanyun.modules.order.model.vo.SubmitShopOrderVo;
import com.songlanyun.modules.order.service.ChildOrderService;
import com.songlanyun.modules.order.service.CreateOrderService;
import com.songlanyun.modules.order.service.impl.coupon.platformcoupon.IUsePlatformCouponService;
import com.songlanyun.modules.order.service.impl.coupon.shopcoupon.IUseShopCouponService;
import com.songlanyun.modules.order.service.impl.platformpoin.IUsePlatformPoint;
import com.songlanyun.modules.payorder.entity.PayOrder;
import com.songlanyun.modules.payorder.service.PayOrderService;
import com.songlanyun.modules.singlegoods.entity.ProductSingleGoodsEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 普通商品秒杀订单构单与下单
 */
@Service("seckillGoodsCreateOrderService")
public class SeckillGoodsCreateOrderServiceImpl extends ServiceImpl<OrderDao, Order> implements CreateOrderService {

    @Resource(name = "createOrderService")
    private CreateOrderService createOrderService;

    @Autowired
    private GoodsService goodsService;


    @Autowired
    private PayOrderService payOrderService;

    @Autowired
    private ChildOrderService childOrderService;


    @Autowired
    private SeckillActivityService seckillActivityService;

    @Autowired
    private SeckillGoodsSkuService seckillGoodsSkuService;
    @Autowired
    private UserIdentityAssetService userIdentityAssetService;

    @Autowired
    private SeckillActivityGoodsService seckillActivityGoodsService;

    @Resource(name = "seckillOrderUseShopCouponService")
    private IUseShopCouponService seckillOrderUseShopCouponService;

    @Resource(name = "commonOrderUsePlatformCouponService")
    private IUsePlatformCouponService commonOrderUsePlatformCouponService;

    @Autowired
    private IntegralRecordService integralRecordService;

    @Resource(name = "commonOrderUsePlatformPoint")
    private IUsePlatformPoint commonOrderUsePlatformPoint;
    /**
     * 构建下单页数据
     *
     * @param userId
     * @param dto
     * @return
     */
    @Override
    public SubmitOrderVo buildSubmitOrder(Long userId, SubmitOrderDTO dto) {
        SubmitOrderVo vo = initSubmitOrderVo(userId, dto);
        List<SubmitShopOrderVo> shopOrderVoList = seckillOrderBuild(userId, vo, dto);

        BigDecimal totalMoneyNoFreight = MathUtils.setScale(shopOrderVoList.stream().mapToDouble(c -> c.getTotalAmountNoFreight().doubleValue()).sum());

        BigDecimal totalMoney = MathUtils.setScale(shopOrderVoList.stream().mapToDouble(c -> c.getTotalAmount().doubleValue()).sum());
        BigDecimal totalReducedMoney = MathUtils.setScale(shopOrderVoList.stream().mapToDouble(c -> c.getTotalReduced().doubleValue()).sum());
        BigDecimal totalAmountDecShopCoupon = MathUtils.setScale(shopOrderVoList.stream().mapToDouble(c -> c.getTotalAmountDecShopCoupon().doubleValue()).sum());

        vo.setShopOrders(shopOrderVoList);
        vo.setAreaFeature(shopOrderVoList.get(0).getAreaFeature());
        vo.setTotalAmountDecShopCoupon(totalAmountDecShopCoupon);
        vo.setTotalMoneyNoFreight(totalMoneyNoFreight);
        vo.setTotalMoney(totalMoney);
        vo.setTotalReduced(totalReducedMoney);
//        /**
//         * 1、先在在里计算推荐使用或选择使用的平台优惠券
//         * 2、分摊给给店铺订单
//         * 3、再分摊给店铺订单的商品子订单
//         */
//        commonOrderUsePlatformCouponService.handlePlatformCoupon(userId, vo);
//        if(vo.getPlatformCoupon().getCouponId()>0) {
//            vo.setTotalMoneyNoFreight(MathUtils.subtract(vo.getTotalMoneyNoFreight(),vo.getPlatformCoupon().getCouponResultValue()));
//            vo.setTotalMoney(MathUtils.subtract(vo.getTotalMoney(),vo.getPlatformCoupon().getCouponResultValue()));
//            vo.setTotalReduced(MathUtils.add(vo.getTotalReduced(),vo.getPlatformCoupon().getCouponResultValue()));
//        }
//
//        if(dto.getUsePlatformPoint()) {
//            BigDecimal platformPoint = commonOrderUsePlatformPoint.handle(vo);
//            if (platformPoint.compareTo(BigDecimal.ZERO) > 0) {
//                vo.setTotalPoint(platformPoint);
//                vo.setTotalMoneyNoFreight(MathUtils.subtract(vo.getTotalMoneyNoFreight(), platformPoint));
//                vo.setTotalMoney(MathUtils.subtract(vo.getTotalMoney(), platformPoint));
//                vo.setTotalReduced(MathUtils.add(vo.getTotalReduced(), platformPoint));
//            }
//        }
//        else
//        {
//            UserIdentityAssetEntity asset = userIdentityAssetService.getById(vo.getUserId(), true);
//            vo.setIntegralAble(asset.getIntegralAble());
//        }

        UserIdentityAssetEntity asset = userIdentityAssetService.getById(vo.getUserId(), true);
        vo.setIntegralAble(asset.getIntegralAble());
        vo.setPointEnough(true);
        return vo;
    }


    /**
     * 会员下单服务
     *
     * @param userId
     * @param dto
     * @return
     */

    @Override
    public PayOrder createPayOrder(Long userId, SubmitOrderDTO dto) {
        /**
         * 校验商品或活动商品限购，校验活动商品是否过期
         */
        validateKill(userId, dto);
        /**
         * 构建下单数据
         */
        SubmitOrderVo submitOrderVo = buildSubmitOrder(userId, dto);

        // TODO 去掉聚合供应链的检查，否则所有秒杀商品都无法下单
        // thirdCanSaleCheck(submitOrderVo);

        /**
         *
         * 提取商品图片为了待支付订单
         */
        List<String> goodsImages = new ArrayList<>();
        submitOrderVo.getShopOrders().forEach(o -> {
            o.getItems().forEach(c -> {
                goodsImages.add(c.getGoodsCover());
            });
        });
        long expiredTimestamp = 0L;
        Long activityId = 0L;
        Long activityGoodsId = 0L;
        Long goodsId = 0L;
        int activityGoodsNum = 0;


        /**
         * 活动订单计算支付过期时间
         */
        activityId = submitOrderVo.getShopOrders().get(0).getActivityId();
        activityGoodsId = submitOrderVo.getShopOrders().get(0).getItems().get(0).getActivityGoodsId();
        activityGoodsNum = submitOrderVo.getShopOrders().get(0).getItems().get(0).getNum();
        goodsId = submitOrderVo.getShopOrders().get(0).getItems().get(0).getGoodsId();

        SeckillActivity seckillActivity = seckillActivityService.getById(activityId, true);
        expiredTimestamp = seckillActivity.getPayExpireTime(System.currentTimeMillis());


        /**
         * 创建支付订单（1，用来做合单，2用来做支付）
         */
        PayOrder payOrder = payOrderService.initPayOrderForSale(userId, submitOrderVo.getTotalMoney(), submitOrderVo.getTotalReduced(), OrderConstant.PayMode.BALANCE, OrderConstant.OrderType.SALE_ORDER, goodsImages, expiredTimestamp, submitOrderVo.getPlatformCoupon(),submitOrderVo.getAreaFeature());
        try {

            List<SubmitShopOrderVo> shopOrders = submitOrderVo.getShopOrders();
            for (SubmitShopOrderVo shopOrder : shopOrders) {
                /**
                 * 开始创建商家订单
                 */
                Order order = createOrder(userId, payOrder, submitOrderVo, shopOrder);
                if(order.getTotalPoint().compareTo(BigDecimal.ZERO)>0) {
                    integralRecordService.outer(order.getUserId(), order.getTotalPoint(),
                            IntegralConstant.OuterMode.POINT_PLATFORM, IntegralConstant.IntegralModelType.ORDER, order.getId(),
                            String.format("平台公益积分抵扣订单[%s]扣除积分:%.2f", order.getOrderCode(), order.getTotalPoint()));
                }
                /**
                 * 创建收货地址或自提信息
                 */
                createOrderReceiving(order, submitOrderVo);
                /**
                 * 创建订单的钥匙
                 */
                createOrderKey(order);
                List<SubmitChildOrderVo> items = shopOrder.getItems();
                for (SubmitChildOrderVo childOrderVo : items) {
                    /**
                     * 创建订单的商品子订单明细
                     */
                    childOrderService.create(order, childOrderVo);
                }

                /**
                 * 如果是秒杀,增加秒杀销量，减少它的库存
                 */
                seckillActivityGoodsService.addSaleNum(order);

            }
        } catch (RRException ex) {
            /**
             * 如果是秒杀活动发生异常要释放信号量
             */
            seckillActivityGoodsService.release(activityId, activityGoodsId, goodsId, activityGoodsNum);
            throw ex;
        }

        return payOrder;
    }

    @Override
    public void thirdCanSaleCheck(SubmitOrderVo vo) {
        createOrderService.thirdCanSaleCheck(vo);
    }


    /**
     * 校验秒杀商品
     *
     * @param userId
     * @param dto
     */
    private void validateKill(Long userId, SubmitOrderDTO dto) {
        SubmitShopOrderDTO killOrder = dto.getShopOrders().get(0);
        SubmitChildOrderDTO killChild = killOrder.getItems().get(0);
        //秒杀商品限购
        Long activityGoodsId = killChild.getActivityGoodsId();
        Long activityId = killOrder.getActivityId();
        Long goodsId = killChild.getGoodsId();
        Integer buyNum = killChild.getNum();

        Boolean aBoolean = seckillActivityGoodsService.tryAcquire(activityId, activityGoodsId, goodsId, buyNum);
        if (!aBoolean) {
            throw new RRException(GoodsExceptionEnum.SECKILL_GOODS_STOCK_NO);
        }
        SeckillActivityGoods goods = seckillActivityGoodsService.loadActivityGoodsById(activityGoodsId, true);
        try {
            if (goods.getResidueStockTotal() < buyNum) {
                throw new RRException(GoodsExceptionEnum.SECKILL_GOODS_STOCK_NO);
            }

            if (goods.getLimitBuyNum() > 0) {
                if (buyNum > goods.getLimitBuyNum()) {
                    throw new RRException("该秒杀商品:每人只能购买" + goods.getLimitBuyNum() + "件", GoodsExceptionEnum.GOODS_LIMIT_BUY.getCode());
                } else {
                    Integer buyGoodsCount = childOrderService.getBuyGoodsCount(userId, activityGoodsId, dto.getMarketingType());
                    if (buyGoodsCount + buyNum > goods.getLimitBuyNum()) {
                        throw new RRException("该秒杀商品:每人只能购买" + goods.getLimitBuyNum() + "件", GoodsExceptionEnum.GOODS_LIMIT_BUY.getCode());
                    }
                }
            }
        } catch (RRException ex) {
            seckillActivityGoodsService.release(goods, buyNum);
            throw ex;
        }


    }

    /**
     * 内部调用初始化订单的基础数据================================================
     *
     * @param userId
     * @param dto
     * @return
     */
    @Override
    public SubmitOrderVo initSubmitOrderVo(Long userId, SubmitOrderDTO dto) {
        return createOrderService.initSubmitOrderVo(userId, dto);
    }

    /**
     * 重构初始化构造提交商家订单vo
     *
     * @param userId
     * @param dto
     * @param o
     * @return
     */
    @Override
    public SubmitShopOrderVo initBuildSubmitShopOrderVo(Long userId, SubmitOrderDTO dto, SubmitShopOrderDTO o) {
        return createOrderService.initBuildSubmitShopOrderVo(userId, dto, o);
    }

    /**
     * 重构初始化构造提交商家子订单vo
     *
     * @param saleEntity
     * @param dto
     * @param o
     * @param s
     * @return
     */
    @Override
    public SubmitChildOrderVo initBuildSubmitChildOrderVo(ISaleEntity saleEntity, SubmitOrderDTO dto, SubmitShopOrderDTO o, SubmitChildOrderDTO s) {

        return createOrderService.initBuildSubmitChildOrderVo(saleEntity, dto, o, s);

    }

    @Override
    public void computeSelectedShopCoupon(Long userId, SubmitShopOrderVo vo, SubmitShopOrderDTO o) {
        createOrderService.computeSelectedShopCoupon(userId, vo, o);
    }

    @Override
    public void backStageManagement(GiveBalanceDTO dto) {

    }

    /**
     * 秒杀订单构单
     *
     * @param userId
     * @param vo
     * @param dto
     * @return
     */
    private List<SubmitShopOrderVo> seckillOrderBuild(Long userId, SubmitOrderVo vo, SubmitOrderDTO dto) {
        return dto.getShopOrders().stream().map(o -> {

            SubmitShopOrderVo shopOrderVo = initBuildSubmitShopOrderVo(userId, dto, o);
            if(shopOrderVo.getPlatformShop())
            {
                vo.setHasPlatform(true);
            }
            //如果是秒杀
            shopOrderVo.setActivityId(o.getActivityId());
            SeckillActivity seckillActivity = seckillActivityService.getById(shopOrderVo.getActivityId());
            shopOrderVo.setActivityTitle(seckillActivity.getName());
            shopOrderVo.setSponsorActivityId(0L);

            List<SubmitChildOrderVo> childOrderVoList = o.getItems().stream().map(s -> {
                Goods goods = goodsService.getByShopIdAndId(o.getShopId(), s.getGoodsId());
                shopOrderVo.setThird(goods.getThird());
                SubmitChildOrderVo childOrderVo = initBuildSubmitChildOrderVo(goods, dto, o, s);
                SeckillGoodsSku goodsSku = seckillGoodsSkuService.getBySeckillGoodsAndSkuHashCode(childOrderVo.getActivityGoodsId(), s.getSkuHashCode());
                if (goodsSku == null) {
                    //如果商品规格不存在,报错
                    throw new RRException(GoodsExceptionEnum.PRODUCT_SKU_NOT_EXISTS);
                }
                ProductSingleGoodsEntity singleGoods = goodsSku.loadSingleGoods();
                if (singleGoods == null) {
                    //库存不存在
                    throw new RRException(GoodsExceptionEnum.SINGLE_GOODS_STOCK_NOT_EXISTS);
                }
                childOrderVo.setAreaFeature(goods.getAreaFeature());
                childOrderVo.setSkuHashCode(s.getSkuHashCode());
                childOrderVo.setSkuSetName(goodsSku.getSkuSetName());
                childOrderVo.setSkuBarCode(goodsSku.getBarCode());
                childOrderVo.setSingleGoodsId(singleGoods.getId());
                childOrderVo.setSingleGoodsCode(singleGoods.getCode());
                childOrderVo.setSingleGoodsTitle(singleGoods.getTitle());
                childOrderVo.setUnit(singleGoods.getUnit());
                childOrderVo.setThirdSkuId(goodsSku.getThirdSkuId());

                if (StringUtils.isNotBlank(goodsSku.getCover())) {
                    childOrderVo.setGoodsCover(goodsSku.getCover());
                }
                SeckillActivityGoods activityGoods = goodsSku.loadActivityGoods();
                Integer ableStock = singleGoods.getAbleStock();
                if (activityGoods.getRealStockTotal() < singleGoods.getAbleStock()) {
                    ableStock = activityGoods.getRealStockTotal();
                }
                if (s.getNum() <= ableStock) {
                    //0库存足够
                    childOrderVo.setStockStatus(0);
                    //2库存紧张
                    if (ableStock < 10) {
                        childOrderVo.setStockStatus(2);
                    }

                } else {
                    //1库存不足
                    childOrderVo.setStockStatus(1);
                }
                //设置重量
                childOrderVo.setWeight(goodsSku.getWeight());
                childOrderVo.setTotalWeight(MathUtils.multiply(new BigDecimal(s.getNum()), goodsSku.getWeight()));
                //设总体积
                childOrderVo.setVolume(goodsSku.getVolume());
                childOrderVo.setTotalVolume(MathUtils.multiply(new BigDecimal(s.getNum()), goodsSku.getVolume()));
                //设总成本
                childOrderVo.setCost(singleGoods.getCostPrice());
                childOrderVo.setTotalCost(MathUtils.multiply(new BigDecimal(s.getNum()), singleGoods.getCostPrice()));
                //首页优惠分摊
                childOrderVo.setFirstOrderReduced(BigDecimal.ZERO);
                //赠送积分
                childOrderVo.setGiveBackPoint(goods.getGivePoint());
                childOrderVo.setTotalGiveBackPoint(MathUtils.multiply(goods.getGivePoint(), new BigDecimal(s.getNum())));

                childOrderVo.setConsumptionValue(goods.getConsumptionValue());
                childOrderVo.setTotalConsumptionValue(MathUtils.setScale(goods.getConsumptionValue().doubleValue() * s.getNum()));


                childOrderVo.setFactPrice(goodsSku.getActivityPrice());
                childOrderVo.setSalePrice(goodsSku.getSalePrice());
                childOrderVo.setMarketPrice(goods.getMaxMarketPrice());
                BigDecimal original = MathUtils.multiply(goodsSku.getSalePrice(), new BigDecimal(s.getNum()));
                childOrderVo.setTotalPrice(MathUtils.multiply(goodsSku.getActivityPrice(), new BigDecimal(s.getNum())));
                childOrderVo.setTotalFactPrice(childOrderVo.getTotalPrice());
                childOrderVo.setOriginalGoodsAmount(MathUtils.multiply(goodsSku.getSalePrice(), new BigDecimal(s.getNum())));
                childOrderVo.setTotalReduced(MathUtils.subtract(original, childOrderVo.getTotalPrice()));

                childOrderVo.setExchangePoint(BigDecimal.ZERO);
                childOrderVo.setTotalPoint(BigDecimal.ZERO);
                return childOrderVo;
            }).collect(Collectors.toList());


            //每家店的商品总费用
            BigDecimal totalAmount = MathUtils.setScale(childOrderVoList.stream().mapToDouble(c -> c.getTotalPrice().doubleValue()).sum());
            //设算每家店的商品快递费用
            BigDecimal totalFreight = BigDecimal.ZERO;
            if (dto.getShipmentMode() == 0) {
                if (vo.getReceipt() != null) {
                    totalFreight = processFreight(o.getShopId(), vo.getReceipt(), childOrderVoList);
                }
            }
            shopOrderVo.setItems(childOrderVoList);
            shopOrderVo.setAreaFeature(childOrderVoList.get(0).getAreaFeature());
            //订单商品总价
            shopOrderVo.setTotalGoodsAmount(totalAmount);


//            computeSelectedShopCoupon(userId, shopOrderVo, o);
//            seckillOrderUseShopCouponService.handleShopCoupon(userId, shopOrderVo);

            //每家店的订单商品总优惠
            BigDecimal totalReduced = MathUtils.setScale(childOrderVoList.stream().mapToDouble(c -> c.getTotalReduced().doubleValue()).sum());
            //每家店的订单商品总优惠
            shopOrderVo.setTotalReduced(MathUtils.add(totalReduced, shopOrderVo.getShopCoupon().getCouponResultValue()));
            shopOrderVo.setFirstOrderReduced(BigDecimal.ZERO);

            //订单运费
            shopOrderVo.setTotalFreight(totalFreight);

            //不含运费，扣出首单，没扣除优惠券的费用
            shopOrderVo.setTotalAmountNoCoupon(totalAmount);
            //不含运费的订单总费用
            shopOrderVo.setTotalAmountNoFreight(MathUtils.setScale(totalAmount.doubleValue() - shopOrderVo.getShopCoupon().getCouponResultValue().doubleValue()));
            //不含运费，扣出首单，扣除店铺优惠券的费用
            shopOrderVo.setTotalAmountDecShopCoupon(shopOrderVo.getTotalAmountNoFreight());

            //不含运费，扣出首单，扣除店铺优惠券的费用,扣出平台抵扣积分
            shopOrderVo.setTotalAmountDecPlatformPoint(shopOrderVo.getTotalAmountNoFreight());

            //订单总费用
            shopOrderVo.setTotalAmount(MathUtils.add(shopOrderVo.getTotalAmountNoFreight(), totalFreight));
            //订单总成本
            shopOrderVo.setTotalCost(MathUtils.setScale(childOrderVoList.stream().mapToDouble(ss -> ss.getTotalCost().doubleValue()).sum()));

            shopOrderVo.setOriginalGoodsAmount(MathUtils.setScale(childOrderVoList.stream().mapToDouble(ss -> ss.getOriginalGoodsAmount().doubleValue()).sum()));
            //订单商品总数
            shopOrderVo.setGoodsNum(childOrderVoList.stream().mapToInt(SubmitChildOrderVo::getNum).sum());
            //可赠送积分
            shopOrderVo.setTotalGiveBackPoint(MathUtils.setScale(childOrderVoList.stream().mapToDouble(c -> c.getTotalGiveBackPoint().doubleValue()).sum()));
            //总共需要赠送多少贡献值
            shopOrderVo.setTotalConsumptionValue(MathUtils.setScale(childOrderVoList.stream().mapToDouble(t -> t.getTotalConsumptionValue().doubleValue()).sum()));

            shopOrderVo.setTotalPoint(BigDecimal.ZERO);
            shopOrderVo.setPointGoods(false);
            return shopOrderVo;
        }).collect(Collectors.toList());
    }

    /**
     * 创建订单的钥匙
     *
     * @param order
     */
    @Override
    public void createOrderKey(Order order) {
        createOrderService.createOrderKey(order);
    }

    /**
     * 创建收货地址或自提信息
     *
     * @param order
     * @param vo
     */
    @Override
    public void createOrderReceiving(Order order, SubmitOrderVo vo) {
        createOrderService.createOrderReceiving(order, vo);
    }


    /**
     * 创建订单
     *
     * @param userId
     * @param payOrder
     * @param submitOrderVo
     * @param vo
     * @return
     */
    @Override
    public Order createOrder(Long userId, PayOrder payOrder, SubmitOrderVo submitOrderVo, SubmitShopOrderVo vo) {
        return createOrderService.createOrder(userId, payOrder, submitOrderVo, vo);
    }


    /**
     * 计算一个店铺下的订单的所有商品的运费合计
     *
     * @param shopId
     * @param receipt
     * @param childOrderVoList
     * @return
     */
    @Override
    public BigDecimal processFreight(Long shopId, SubmitOrderReceiptVo receipt, List<SubmitChildOrderVo> childOrderVoList) {
        return createOrderService.processFreight(shopId, receipt, childOrderVoList);
    }

}
